package com.ehome.poct.core.api.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 检测结果
 *
 * @author muqiu
 * @since 2022/03/03 10:28
 **/
@Data
@ApiModel("检测结果")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class CheckResultVO {

    public CheckResultVO(CheckResultVO old){
        this.type = old.type;
        this.status = old.status;
        this.unit = old.unit;
        this.rrs = old.rrs;
        this.order = old.order;
        this.stripTypeCode = old.stripTypeCode;
    }

    @ApiModelProperty("检测名称")
    private String typeName;
    @ApiModelProperty("检测英文名称")
    private String type;
    @ApiModelProperty("数据状态 2：超出范围")
    private int status;
    @ApiModelProperty("单位")
    private String unit;
    @ApiModelProperty("参考范围")
    @JsonProperty(value = "RRs")
    private String rrs;
    @ApiModelProperty("结果值")
    private String value;
    @JsonIgnore
    private Long order;
    @JsonIgnore
    private String code;
    @JsonIgnore
    private Integer stripTypeCode;

    public CheckResultVO setValue(String value){
        this.value = value;
        this.status = value.contains("↑") || value.contains("↓") || value.contains("≥") ? 2 : 0;
        return this;
    }
}